package com.twp.auth.config.aware;

import com.twp.auth.service.RequestUrlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AuthApplicationListener implements ApplicationListener<ApplicationReadyEvent> {

    @Autowired
    RequestUrlService requestUrlService;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        try{
            requestUrlService.updateRequestUrl();
        }catch (Exception e){
            log.error("updateRequestUrl:",e.getMessage());
        }
    }
}
